大安 |
测试 |
张警官 |
自贡市公安局 |
管理员 |
信息中心 |
自贡公安局指挥中心 |
招生办 |
赵警官 |
沿滩 |
富顺 |
富顺用户 |
贡井 |
贡井用户 |
自流井 |
实际为:
<%=zNodes %>
css
.tree_table{ border-collapse:collapse;border-spacing:0px;border: medium none;}.tree_table tr{ vertical-align:middle;height:30px;line-height:30px;border: medium none;}.tree_table tr td{ padding-left:10px;vertical-align:middle;border: medium none;}.tree_table tr td input{ vertical-align:middle;margin-left:10px}.tree_table tr td img { vertical-align:middle;margin:0 5px}.tree_table .default_node, .tree_table .default_active_node { vertical-align:middle;width:30px;height:30px;line-height:30px;border: medium none; margin: 0; padding: 0;display: inline-block;}.tree_table .default_active_node { cursor: pointer;}.tree_table .default_leaf{ background:url(allbgs.png) no-repeat -33px -5px;width:30px;}/*T线*/.tree_table .default_last_leaf{ background:url(allbgs.png) no-repeat -120px -5px;width:30px;}/*折线*/.tree_table .default_vertline{ background:url(allbgs.png) no-repeat -57px -5px;width:30px;}/*竖线*/.tree_table .default_open, .tree_table .default_hover_open{ vertical-align:middle;background:url(allbgs.png) no-repeat -0px -5px;width:30px;}.tree_table .default_shut, .tree_table .default_hover_shut{ vertical-align:middle;background:url(allbgs.png) no-repeat -87px -5px;width:30px;}.tree_table .default_last_shut, .tree_table .default_hover_last_shut{ background:url(allbgs.png) no-repeat -158px -5px;width:30px;}.tree_table .default_last_open, .tree_table .default_hover_last_open{ background:url(allbgs.png) no-repeat -203px -5px;width:34px;}
asp.net后台代码
由两张表构成,一张部门表,一张人员表,人员和部门的关系为:人员所属部门
private string TreeTable() { BLL.department bll = new BLL.department(); DataTable dt = bll.GetList(0);//获取所有部门 BLL.manager blluser = new BLL.manager(); StringBuilder JsonData = new StringBuilder(); JsonData.Append("
" + dr["depart_name"].ToString() + " | \r\n"); JsonData.Append("
" + rowuser["real_name"].ToString() + " | \r\n"); JsonData.Append("
protected string zNodes="";//页面加载事件protected void Page_Load(object sender, EventArgs e){ if (!Page.IsPostBack) { this.zNodes = TreeTable(); }}
TreeTable基础讲解:http://www.cnblogs.com/qigege/p/5213639.html